package com.ydd.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.pagehelper.Page;
import com.ydd.dto.YddAdvposPageDTO;
import com.ydd.entity.YddAdvpos;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import com.ydd.vo.YddAdvposPageVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author itcast
 * @since 2023-05-15
 */
public interface YddAdvposMapper extends BaseMapper<YddAdvpos> {
    @Select("select * from ydd_advpos")
    List<Integer> adbposList();

    /**
     * 分页查询
     * @param yddAdvposPageDTO
     * @return
     */
    Page<YddAdvposPageVO> pageQuery(YddAdvposPageDTO yddAdvposPageDTO);

    /**
     * 根据id查询广告位详情
     * @param id
     * @return
     */
    //改为MP
    //@Select("select * from ydd_advpos where id = #{id};")
    //YddAdvpos selectById(Integer id);

    /**
     * 广告位修改
     * @param yddAdvpos
     */
    void update(YddAdvpos yddAdvpos);

    /**
     * 广告位查询所有
     * @return
     */
    //改为MP
    //@Select("select * from ydd_advpos")
    //List<YddAdvpos> findAll();

    /**
     * 添加广告位
     * @param yddAdvpos
     */
    @Insert("insert into ydd_advpos (advposname, advposdesc, advpossize, default_data) values (#{advposname}, #{advposdesc}, #{advpossize}, #{defaultData})")
    void add(YddAdvpos yddAdvpos);

    /**
     * 删除广告位
     * @param id
     */
    @Delete("delete from ydd_advpos where id = #{id};")
    void deleteById(Integer id);

    /**
     * 统计广告位总数
     * @return
     */
    @Select("select count(*) from ydd_advpos")
    Integer count();
}
